

<!--<form action="--><?//= URL::curr()?><!--" method="post" class="col-sm-6 col-md-4 ajax-submit">-->
    <?php foreach ($arr as $item):?>
    <div class="form-group">

        <?= $item['name']?> <span class="num"><?=$item['num'] ?></span> 位
<!--        <a href="" >减少</a>-->
        <span class="btn btn-info btn-xs incr" data-num="<?=$item['num']?>" data-name = <?=$item['name'] ?> data-pid = <?= $pid?>>减少</span>
        <span class="btn btn-info btn-xs redu" data-name = <?=$item['name'] ?> data-pid = <?= $pid?>>增加</span>
<!--        <a href="--><?//= URL::site('plan/reduce?name='.$item['name'].'&id='.$pid);?><!--" class="btn btn-info btn-xs ">增加</a>-->
	</div>
    <?php endforeach;?>


<script>
    $(function () {
        $('.incr').click(function(){
            var t = $(this);
            var name = $(this).data('name');
            var pid = $(this).data('pid');
            var num = $(this).data('num');
            $.post('<?= URL::site('plan/increase') ?>',{name:name,pid:pid,num:num}, function (res) {
            //    console.log(res);
                t.parents('.form-group').find('.num').html(res);
            })
        })
    })
    $(function () {
        $('.redu').click(function(){
            var t = $(this);
            var name = $(this).data('name');
            var pid = $(this).data('pid');
            var num = $(this).data('num');
            $.post('<?= URL::site('plan/reduce') ?>',{name:name,pid:pid,num:num}, function (res) {
                t.parents('.form-group').find('.num').html(res);
            })
        })
    })



    </script>
<!--</form>-->
